<!DOCTYPE html>
<html lang="en" xmlns:th="https://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>用户列表展示页</title>
    <script th:src="@{/webjars/jquery/3.2.1/dist/jquery.min.js}"></script>
    <script th:src="@{/webjars/bootstrap/4.3.1/js/bootstrap.min.js}"></script>
    <link rel="stylesheet" th:href="@{/webjars/bootstrap/4.3.1/css/bootstrap.min.css}" />
    <link rel="stylesheet" type="text/css" th:href="@{/static/css/style.css}" />
    <style type="text/css">
        #user-table{
            width: 100%;
        }
        #user-table th, tr{
            height: 36px;
        }
    </style>
</head>
<body>
<div class="container">
    <a th:href="@{/user/toinsert}" class="btn-info">新添用户</a>
    <table id="user-table" class="table-striped">
        <tr>
            <th>No.</th>
            <th>姓名</th>
            <th>年龄</th>
            <th>性别</th>
            <th>生日</th>
            <th>备注</th>
            <th>操作</th>
        </tr>
        <tr th:each="user, statu : ${userList}">
            <td th:text="${statu.count}"></td>
            <td th:text="${user.name}"></td>
            <td th:text="${user.age}"></td>
            <td>
                <span th:if="${user.sex == 1}">男</span>
                <span th:if="${user.sex == 2}">女</span>
            </td>
            <td th:text="${user.birthday eq null} ? '保密' : ${#dates.format(user.birthday, 'yyyy-MM-dd')}"></td>
            <td th:text="${user.note}"></td>
            <td>
                <a th:href="@{/user/delete/{id}(id=${user.id})}">删除</a>
                <a th:href="@{/user/toupdate/{id}(id=${user.id})}">修改</a>
            </td>
        </tr>
    </table>
</div>
</body>
</html>